﻿using System;
using System.IO;
using RIABlog.Web.Helpers;
using RIABlog.Web.Resources;

namespace RIABlog.Web.Models
{
	public class AgreeCommand : BaseCommand
	{
		#region Overrides of BaseCommand

		public override string Hint
		{
			get { return CommandResources.AgreeCommandHint; }
		}

		public override string RelativeImageUrl
		{
			get { return "thumb_up.png"; }
		}

		public override int OrderPos
		{
			get { return 1; }
		}

		internal override string Execute(Guid blogPostId)
		{
			var folderInfo = new DirectoryInfo(EntityExtensions.GetExistingBlogPostFolder(blogPostId));
			var titleAndId = folderInfo.Name.Split(EntityExtensions.NameSeparator);

			return string.Format(CommandResources.AgreeCommandResult, titleAndId[0]);
		}

		#endregion
	}
}